// ==UserScript==
// @name         金山词霸划词翻译 JAE
// @namespace    http://git.oschina.net/jae/tampermonkeyScripts
// @version      0.1
// @description  在页面上双击某个词就会弹出翻译，或者选择一段话也可以翻译
// @author         Jaeger <hj.q@qq.com>
// @include        http*
// @grant        none
// @icon http://www.iciba.com/favicon.ico
// @run-at document-end
// ==/UserScript==

var main = (function(){
      var E;
   E = function(file, type) {
     var ele;
     if (type == null) {
       type = "js";
     }
     if (type === "js") {
       ele = document.createElement("script");
       ele.type = "text/javascript";
       ele.src = file;
     } else {
       ele = document.createElement("link");
       ele.type = "text/css";
       ele.rel = "stylesheet";
       ele.href = file;
     }
     return document.getElementsByTagName("head")[0].appendChild(ele);
   };
   E("http://open.iciba.com/huaci/mini.css","css");
  //开启划词翻译 
  window.ICIBA_HUAYI_ALLOW=1;
   window.iciba_huaci_url ="http://open.iciba.com/huaci/";
   var html = '<div id="icIBahyI-yi" style="display:none"></div><div id="icIBahyI-main_box" style="display:none">    <div class="icIBahyI-main_title" id="icIBahyI-main_title" >        <a href="javascript:;" id="icIBahyI-gb" class="icIBahyI-gb" title="关闭"></a>        <a href="javascript:;" id="icIBahyI-dq" class="icIBahyI-dq2" title="点击固定结果"></a>       爱词霸 即划即译       <div class="icIBahyI-sz_list" id="icIBahyI-sz_list">            <a href="javascript:;">关闭即划即译</a>            <a href="#" target="_blank">反馈</a>            <a href="#" style="border:none;" target="_blank">帮助</a>            <span class="icIBahyI-j icIBahyI-tl"></span>            <span class="icIBahyI-j icIBahyI-tr"></span>            <span class="icIBahyI-j icIBahyI-bl"></span>            <span class="icIBahyI-j icIBahyI-br"></span>        </div>    </div>    <div class="icIBahyI-search">        <input id="ICIBA_HUAYI_input" name="" type="text" onkeydown="ICIBA_HUAYI_KEYDOWN(event);">        <a href="javascript:;" class="icIBahyI-sear" onclick="ICIBA_HUAYI_searchword()" >查 词</a>    </div> <span class="icIBahyI-contTop"></span>    <div class="icIBahyI-loading" id="loading"> </div>        <div class="icIBahyI-main_cont" id="icIBahyI-main_cont"></div> <div class="icIBahyI-CB" id="icIBahyI-scbiframe" style="display:none"></div><div id="ICIBA_TOO_LONG" style="height:150px" class="icIBahyI-footer">您划取的内容太长，建议您去爱词霸<a href="http://fy.iciba.com">翻译</a>页面。</div><div class="icIBahyI-down"><a href="http://ciba.iciba.com/" onclick="clickCountIndex(26)"  target="_blank">搞定邮箱/文档/pdf取词？下载词霸PC版</a></div>    <span class="icIBahyI-contB"></span></div><script src="http://open.iciba.com/huaci/dict.php" charset="utf-8"></script><object style="height:0px;width:0px;overflow:hidden;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="0" height="0" id="asound_hanci" align="absmiddle">        <param name="allowScriptAccess" value="always" />       <param name="movie" value="http://www.iciba.com/top/asound.swf" />        <param name="quality" value="high" />        <embed src="http://www.iciba.com/top/asound.swf" quality="high" width="0" height="0" name="asound_hanci" align="absmiddle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />    </object> <div class="icIBahyI-USER_LOGIN" id="icIBahyI-USER_LOGIN" style="display:none"></div>';
     var ele = document.createElement('div');
     ele.id = "hj";
     ele.innerHTML = html;
     document.body.appendChild(ele);
     E("http://open.iciba.com/huaci/ICIBA_HUACI_COM.js");
});
window.setTimeout(main,500);
